package com.sky.config;

import com.sky.properties.MinioProperties;
import com.sky.utils.MinioUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类，用于创建MinioUtils对象
 */
@Configuration
@Slf4j
public class OssConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public MinioUtils minioUtils(MinioProperties minioProperties) {
        log.info("开始创建MinioUtils对象，参数：{}", minioProperties);
        return new MinioUtils(minioProperties.getEndpoint(),
                minioProperties.getAccessKey(),
                minioProperties.getSecretKey(),
                minioProperties.getBucketName());
    }
}
